package com.zhanggm.springcloud.user.api;


import com.zhanggm.springcloud.user.api.model.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "service-user")
public interface UserApi {

    /**
     * 根据Id，查询用户名称
     * @param id
     * @return
     */
//    @RequestMapping(value = "/getUsernameById/",method = RequestMethod.GET)
    @GetMapping("/user/getUsernameById")
    public String getUsernameById(@RequestParam("id") Integer id);

    /**
     * 根据用户Id，查询用户信息
     * @param id
     * @return
     */
    @GetMapping("/user/getUserById")
    public User getUserById(@RequestParam("id") Integer id);

    /**
     * 根据用户id，查询用户信息
     * @param user
     * @return
     */
    @PostMapping("/user/getUserByUser")
    public User getUserByUser(@RequestBody User user);
}
